#!/bin/bash

usage()
{
   echo "usage: $cmd {--help}"
   echo "       $cmd {-m <\"managed system\"> -k <\"activation key\"> "
   exit $1
}
help()
{
   echo "usage:"
   echo "  --help                - print this message"
   echo "  -m <\"managed system\"> - the machine type and serial number of the"
   echo "                          managed system to execute the CUoD operation."
   echo "                          The name specified must be enclosed in double quotes"
   echo "                          and of the form mmmm*sssss where mmm is the"
   echo "                          model type such as 7040, and ssss is the serial"
   echo "                          number of the managed system."
   echo "  -k <\"activation key\"> - the CUoD Activation Key"
   echo "  NOTE: arguments must be passed in the order specified"
   exit 0
}
cmd=`basename $0`

if [ "$4" = "" ]
then
   usage 1
fi


managedSystem="\"$2\""
activationKey="\"$4\""
set -- `getopt -u -l help "m:k:" $*`

JAVAPATH="/opt/IBMJava2-131/jre/bin/"
x=`type -p java 2>/dev/null`
if [ "$x" != "" ]
then
  JAVAPATH=`/usr/bin/dirname $x`
fi
export CLASSPATH=/opt/hsc:/usr/websm/codebase/pluginjars/hsc.jar:/usr/websm/codebase/pluginjars/sniacimom.jar:/usr/websm/codebase/pluginjars/xerces.jar:/usr/websm/codebase/pluginjars/HwmcaCommon.jar:/usr/websm/codebase/pluginjars/auifw.jar:/usr/websm/codebase/wsm.jar:/usr/websm/codebase/pluginjars/rmcjava.jar:$CLASSPATH
export PATH=$JAVAPATH:$PATH
java -Djavax.net.ssl.keyStore=/usr/websm/codebase/SM.pubkr -Djavax.net.ssl.keyStorePassword=defp -Dorg.snia.wbem.cimom.properties=/opt/hsc/data/cim.properties com.ibm.hsc.common.util.CUoDObject "$managedSystem" "$activationKey"
exit 0

